package com.itheima.test1;

public class Test4 {
    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5,6,7,8,9,10};
        int[] newArr = copyOfRange(arr, 3, 7);
        for (int i = 0; i < newArr.length; i++) {
            System.out.print(newArr[i]+" ");
        }
    }

    public static int[] copyOfRange(int[] arr,int from,int to){
        int[] newArr= new int[to-from];
        for (int i = from,j=0; i < to; i++,j++) {
            newArr[j]=arr[i];
        }
        return newArr;
    }
}
